# -*- coding: utf-8 -*-
from django.conf.urls import url
from django.contrib import admin
from  books import views
from books.views import exam,index

from . import apiview_view,genericaoview_view,mixin_view,childmixin_view,ViewSet_view,genericviset_view\
     ,modelviewset_view

from  rest_framework.routers import SimpleRouter
urlpatterns = [

     # url(r'^book_drf/$', exam),
     # #url(r'^books_drf/(?P<pk>\d+)/$', views.BookDRFView.as_view()),
     # url(r'^books_drf/$', apiview_view.BookDRFView.as_view()),
     # url(r'^books/$',apiview_view.Books.as_view()),
     # url(r'^genbooks/$',genericaoview_view.Books.as_view()),
     #
     # url(r'books_update/(?P<pk>\d+)/$',genericaoview_view.Books.as_view()),#更新图书数据
     # url(r'^hero/$',apiview_view.Hero.as_view())
     # ,url(r'^index/$',exam),
     # url(r'^$',index)


#      """
# 拓展类视图
#      """
#      url(r'^book_drf/$',mixin_view.Books.as_view()),
#      url(r'^books_drf/$',mixin_view.Books.as_view()),
#      url(r'^books_drf/(?P<pk>\d+)/$',mixin_view.BookDRFView.as_view()),
#

#
# """
# 拓展子类视图
# """
#      url(r'^book_drf/$', childmixin_view.Books.as_view()),
#      url(r'^books_drf/$', childmixin_view.Books.as_view()),
#      url(r'^books_drf/(?P<pk>\d+)/$',childmixin_view.BookDRFView.as_view()),

# """"
# 视图集
#      viewset
# """
     #字典进行匹配 只在继承视图集有效
     # url(r'^books_drf/$', ViewSet_view.Books.as_view({'get':'list','post':'create'})),
     # url(r'^books_drf/(?P<pk>\d+)/$',ViewSet_view.BookDRFView.as_view({'put':'update'})),
     # #超过路由原本的方法名 自定义路由匹配
     # url(r'^books_drf/(?P<pk>\d+)/lastdata$',ViewSet_view.BookDRFView.as_view({'get':'lastdata'})),


# """"
#
#      GenericViewSet
# """
#字典进行匹配 只在继承视图集有效
     # url(r'^books_drf/$', genericviset_view.Books.as_view({'get':'list','post':'create'})),
     # url(r'^books_drf/(?P<pk>\d+)/$',genericviset_view.BookDRFView.as_view({'put':'update'})),
     #超过路由原本的方法名 自定义路由匹配
     # url(r'^books_drf/(?P<pk>\d+)/lastdata$',genericviset_view.BookDRFView.as_view({'get':'lastdata'})),

# """"
#
#      modelviewset
# """
# url(r'^books_drf/$', modelviewset_view.Books.as_view({'get': 'list', 'post': 'create'})),
    # url(r'^books_drf/(?P<pk>\d+)/$', modelviewset_view.Books.as_view({'put': 'update','get':'retrieve','delete':'destroy'})),




]

router= SimpleRouter()
router.registry('books_drf',modelviewset_view.Books,base_name='books')
print(router.urls)

urlpatterns+=router.urls